package com.stx.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.stx.pojo.Match;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface MatchMapper extends BaseMapper<Match> {

    @Select("select * from r_match")
    List<Match> selectmatch();

    @Select("select * from r_match where mat_name=#{matName} limit 1")
    Match findByName(@Param("matName") String matName);

    @Insert("insert into r_match(id,rua_id,pla_id,mat_declaration,mat_score,mat_sequence,mat_name,mat_date)"+
            "values (#{id},#{ruaId},#{plaId},#{matDeclaration},#{matScore},#{matSequence},#{matName},#{matDate})")
    void add(Match match);

    @Update("update r_match set rua_id=#{ruaId},pla_id=#{plaId},mat_declaration=#{matDeclaration},mat_score=#{matScore},mat_sequence=#{matSequence},mat_name=#{matName},mat_date=#{matDate} where id=#{id}")
    void updateID(Match match);

    @Update("update r_match set mat_score=#{matScore} where id=#{id}")
    void updateID1(Match match);

    @Delete("delete from r_match where id=#{id}")
    void deleteID(Integer id);
}
